import { Mark, Color } from "./enums";
import { Deck } from "./types";

export function createDeck(): Deck {
  const deck: Deck = [];
  const marks = Object.values(Mark);
  const colors = Object.values(Color);

  for (let m of marks) {
    for (let c of colors) {
      deck.push({
        color: c,
        mark: m,
      });
    }
  }
  return deck;
}

export function printDeck(deck: Deck) {
  let result = "\n";
  deck.forEach((card, idx) => {
    const { color, mark } = card;
    let str = color + mark;
    result += str + "\t";
    if ((idx + 1) % 4 === 0) result += "\n";
  });
  console.log(result);
}
